  <script>
	import { getUserInfoApi, getOpenIdApi } from '@/api/user.js'
	export default {
		onLaunch: async function() {
			/*做登录前身份校验，校验通过免登陆-新的修改*/
			uni.login({
				provider: 'weixin',
				success: async (loginRes) => {
					try {
						// uni.clearStorage()
						const openData = await getOpenIdApi({
							code: loginRes.code
						})
						if(openData.code !=0 ) return
						const openId = openData.data.openId
						const {code, data} = await getUserInfoApi({
							openId
						})
						if(code == 0){
							uni.setStorageSync('openid',data.openId)
							uni.setStorageSync('userId',data.id)
							uni.setStorageSync('phone',data.phone)
							uni.setStorageSync('businessId',data.businessId)
						}
						setTimeout(()=>{
							// lg-dev 的修改
							this.$isResolve && this.$isResolve()
						},500)
					}catch(e){
						console.log(e,'错误')
					}
				}
			})
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
	}
</script>

<style lang="scss">
	@import "./uni_modules/vk-uview-ui/index.scss";
	@import 'libs/common.scss';
	page{
		background-color: #F0F0F0 !important;
	}
</style>
